<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>CSS变量使用</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        html{
            --base-color:#639;
            --highlight-color:#AEA;
            --header-height:64px;
            --footer-height:48px;
        }
        html,body{
            margin: 0;
            padding:0;
            height:100%;
            width:100%;
        }
        h1 {
            color: var(--base-color);
        }
        h2 {
            color: var(--highlight-color);
        }
        #container{
            height:100%;
            position: relative;
        }
        header{
            height:var(--header-height);
            border-style: solid;
            border-width: 0px;
            background-color: antiquewhite;
        }
        footer{
            position:absolute;
            height:var(--footer-height);
            border-style: solid;
            border-width: 0px;
            width:100%;
            background-color: beige;
            bottom:0;
        }

    </style>
</head>
<body>
    <div id='container'>
        <header></header>
        <div>
            <h1>标题1</h1>
            <p>内容</p>
            <h2>标题2</h2>
            <p>其它内容</p>
        </div>
        <footer></footer>
    </div>
</body>
</html>